package module

type CnafMyCatMetric struct {
	Name  string
	Value float64
	Rev   float64
}

type CnafMysqlMetric struct {
	tenant      string
	FlightInfo  float64
	FlightChage float64
	SrvTask     float64
}

type CnafRedisMetric struct {
	//Tenant         string
	FlightKey      string
	TaskCacheKey   string
	FlightValue    float64
	TaskCacheValue float64
}

type CnafAmqMetric struct {
	Name    string
	Connect float64
}

// 转换为json
//func (m *CnafMyCatMetric) String() string {
//	dj, _ := json.Marshal(m)
//	return string(dj)
//}
//func (m *CnafMysqlMetric) String() string {
//	dj, _ := json.Marshal(m)
//	return string(dj)
//}

// 定一个数组接受CnafMyCatMetricSet
//type CnafMyCatMetricSet struct {
//	itmes []*CnafMyCatMetric
//}
//type CnafMySqlMetricSet struct {
//	itmes []*CnafMysqlMetric
//}

func GetCnafMyCat() *CnafMyCatMetric {
	return &CnafMyCatMetric{
		Name:  "next.dbid",
		Value: 1000,
		Rev:   2000,
	}
}

func GetCnafMySql(teant string) *CnafMysqlMetric {

	result := GetMysql(teant)

	return &CnafMysqlMetric{
		tenant:      teant,
		FlightInfo:  result.FlightInfo,
		FlightChage: result.FlightChage,
		SrvTask:     result.SrvTask,
	}
}

func GetCnafRedis(teant string) *CnafRedisMetric {
	return &CnafRedisMetric{
		//Tenant:         teant,
		FlightKey:      "1000",
		FlightValue:    1000,
		TaskCacheKey:   "2000",
		TaskCacheValue: 2000,
	}
}

func GetCnafAmq() *CnafAmqMetric {
	return &CnafAmqMetric{
		Name:    "Subscribers",
		Connect: 400,
	}
}
